.edit-course-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.edit-course-box {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.edit-course-box h2 {
  margin: 0 0 30px 0;
  font-size: 24px;
  color: #333;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

/* 加载和错误状态 */
.loading-container,
.error-container {
  text-align: center;
  padding: 60px 20px;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  margin: 0 auto 20px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error-message {
  color: #ff4d4f;
  font-size: 16px;
  margin-bottom: 20px;
}

.retry-btn,
.back-btn {
  padding: 10px 30px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  margin: 0 5px;
}

.retry-btn:hover,
.back-btn:hover {
  background: #5568d3;
}

/* 表单样式 */
.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #333;
  font-weight: 500;
  font-size: 14px;
}

.form-group label.required::before {
  content: '* ';
  color: #ff4d4f;
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.3s;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
  resize: vertical;
  font-family: inherit;
  min-height: 100px;
}

/* 只读字段 */
.readonly-group input {
  background: #f5f5f5;
  cursor: not-allowed;
  color: #999;
}

/* 电话输入组 */
.phone-input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.phone-input-group input {
  flex: 1;
}

.remove-phone-btn {
  padding: 10px 20px;
  background: #ff4d4f;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
}

.remove-phone-btn:hover {
  background: #ff7875;
}

.add-phone-btn {
  padding: 8px 16px;
  background: #1890ff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
}

.add-phone-btn:hover {
  background: #40a9ff;
}

/* 封面预览 */
.cover-preview {
  margin-bottom: 12px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e8e8e8;
}

.cover-preview img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  display: block;
}

/* 上传按钮 */
.upload-btn {
  display: inline-block;
  padding: 10px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
  text-align: center;
}

.upload-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.upload-tip {
  margin: 8px 0 0 0;
  font-size: 12px;
  color: #999;
  line-height: 1.5;
}

/* 视频播放器区域 */
.video-player-section {
  margin-bottom: 16px;
  padding: 16px;
  background: #f5f7fa;
  border-radius: 8px;
}

.video-player-section h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: #666;
  font-weight: 600;
}

.video-player-wrapper {
  margin-bottom: 16px;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

.video-player {
  width: 100%;
  max-height: 450px;
  display: block;
  background: #000;
}

/* 课时按钮列表 */
.video-episodes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.episode-btn {
  min-width: 80px;
  padding: 8px 16px;
  background: white;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  color: #666;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}

.episode-btn:hover {
  border-color: #667eea;
  color: #667eea;
}

.episode-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #667eea;
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* 现有视频列表（保留用于新上传视频预览） */
.existing-videos {
  margin-bottom: 16px;
  padding: 16px;
  background: #f5f7fa;
  border-radius: 8px;
}

.existing-videos h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: #666;
}

.video-item {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: start;
  padding: 16px 20px;
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  margin-bottom: 16px;
  gap: 16px;
  cursor: move;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.video-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  opacity: 0;
  transition: opacity 0.3s;
}

.video-item:hover::before {
  opacity: 1;
}

.video-item:last-child {
  margin-bottom: 0;
}

.video-item.existing {
  background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
}

.video-item.dragging {
  opacity: 0.6;
  background: linear-gradient(135deg, #f0f2ff 0%, #e8ebff 100%);
  border: 2px dashed #667eea;
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.2);
}

.video-item:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border-color: #d0d7de;
  transform: translateY(-2px);
}

/* 拖拽句柄 */
.drag-handle {
  color: #c0c4cc;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  transition: all 0.3s;
  background: #f5f7fa;
  align-self: center;
}

.drag-handle:hover {
  color: #667eea;
  background: #e8ebff;
  transform: scale(1.1);
}

.drag-handle:active {
  cursor: grabbing;
  transform: scale(0.95);
}

.drag-handle svg {
  width: 16px;
  height: 16px;
}

.video-index {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 32px;
  padding: 0 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
  align-self: center;
}

.video-info-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  align-items: flex-start;
}

.video-preview-thumbnail {
  width: 160px;
  height: 90px;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s;
}

.video-item:hover .video-preview-thumbnail {
  transform: scale(1.02);
}

.video-preview-thumbnail::after {
  content: '▶';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.8);
  font-size: 24px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.video-preview-thumbnail:hover::after {
  opacity: 1;
}

.video-preview-thumbnail video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-title-wrapper {
  width: 100%;
  min-width: 0;
}

.video-title-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s;
  box-sizing: border-box;
  background: #fafafa;
  color: #333;
  font-weight: 500;
}

.video-title-input::placeholder {
  color: #999;
  font-weight: normal;
}

.video-title-input:focus {
  outline: none;
  border-color: #667eea;
  background: white;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  transform: translateY(-1px);
}

.video-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  flex-shrink: 0;
  align-self: center;
}

.video-name {
  flex: 1;
  color: #333;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.video-size {
  color: #999;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}

.video-list {
  margin-top: 16px;
  padding: 20px;
  background: linear-gradient(135deg, #f5f7fa 0%, #ffffff 100%);
  border-radius: 12px;
  border: 1px solid #e8e8e8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.list-header {
  font-size: 15px;
  color: #333;
  margin-bottom: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f0f0f0;
}

.drag-tip {
  font-size: 12px;
  color: #999;
  font-weight: normal;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.drag-tip::before {
  content: '↕';
  font-size: 14px;
}

/* 视频操作按钮 */
.preview-video-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.preview-video-btn::before {
  content: '▶';
  font-size: 10px;
}

.preview-video-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.preview-video-btn:active {
  transform: translateY(0);
}

.reupload-video-btn {
  padding: 8px 16px;
  background: white;
  color: #1890ff;
  border: 1.5px solid #1890ff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.reupload-video-btn::before {
  content: '↻';
  font-size: 14px;
}

.reupload-video-btn:hover {
  background: #1890ff;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(24, 144, 255, 0.3);
}

.reupload-video-btn:active {
  transform: translateY(0);
}

.remove-video-btn {
  padding: 8px 16px;
  background: white;
  color: #ff4d4f;
  border: 1.5px solid #ff4d4f;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.remove-video-btn::before {
  content: '×';
  font-size: 16px;
  font-weight: bold;
}

.remove-video-btn:hover {
  background: #ff4d4f;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 77, 79, 0.3);
}

.remove-video-btn:active {
  transform: translateY(0);
}

/* 操作按钮 */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e8e8e8;
}

.cancel-btn,
.submit-btn {
  padding: 10px 32px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.cancel-btn {
  background: white;
  border: 1px solid #d9d9d9;
  color: #666;
}

.cancel-btn:hover:not(:disabled) {
  border-color: #667eea;
  color: #667eea;
}

.submit-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.cancel-btn:disabled,
.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* 响应式 */
@media (max-width: 768px) {
  .edit-course-container {
    padding: 10px;
  }

  .edit-course-box {
    padding: 20px;
  }

  .edit-course-box h2 {
    font-size: 20px;
  }

  .phone-input-group {
    flex-direction: column;
    gap: 8px;
  }

  .remove-phone-btn {
    width: 100%;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .cancel-btn,
  .submit-btn {
    width: 100%;
  }

  /* 视频播放器响应式 */
  .video-player {
    max-height: 250px;
  }

  .video-episodes {
    gap: 6px;
  }

  .episode-btn {
    min-width: 70px;
    padding: 6px 12px;
    font-size: 13px;
  }

  /* 视频列表响应式 */
  .video-list {
    padding: 12px;
  }

  .video-item {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }

  .drag-handle {
    width: 28px;
    height: 28px;
  }

  .video-index {
    min-width: 40px;
    height: 28px;
    padding: 0 10px;
    font-size: 12px;
  }

  .video-info-group {
    flex-direction: column;
    width: 100%;
    gap: 12px;
    grid-column: 1 / -1;
  }

  .video-preview-thumbnail {
    width: 100%;
    height: auto;
    min-height: 140px;
  }

  .video-title-wrapper {
    width: 100%;
  }

  .video-actions {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    grid-column: 1 / -1;
  }

  .preview-video-btn,
  .reupload-video-btn,
  .remove-video-btn {
    flex: 1;
    min-width: 90px;
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* 视频预览模态框 */
.video-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.preview-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s;
  position: relative;
  padding: 24px;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close-preview-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  z-index: 1;
}

.close-preview-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: rotate(90deg);
}

.preview-content h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  color: #333;
}

.preview-video {
  width: 100%;
  max-height: 70vh;
  background: #000;
  border-radius: 8px;
}

.preview-filename {
  margin: 12px 0 0 0;
  color: #666;
  font-size: 14px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

